//
//  LabelViewController.m
//  TestIos
//
//  Created by HsDev on 2025/6/9.
//  Copyright © 2025 Liyadong. All rights reserved.
//

#import "LabelViewController.h"

@interface LabelViewController ()

@property (nonatomic, strong) UILabel *matchNumberLabel;

@end

@implementation LabelViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    [self.view addSubview:self.matchNumberLabel];
    
    NSString *matchInfoStr = @"这是一段文本\n很长的文本sdfsdfsdfdsfsdfds";
    
    NSMutableAttributedString *matchStr = [[NSMutableAttributedString alloc] initWithString:matchInfoStr];
    
    _matchNumberLabel.attributedText = matchStr;
    
}


- (UILabel *)matchNumberLabel {
    if(!_matchNumberLabel) {
        _matchNumberLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 100, 100, 50)];
        _matchNumberLabel.text = @"测试";
        _matchNumberLabel.backgroundColor = UIColor.cyanColor;
        _matchNumberLabel.numberOfLines = 0;
        _matchNumberLabel.adjustsFontSizeToFitWidth = YES;
        _matchNumberLabel.minimumScaleFactor = 5.0 / 17.0; // 假设默认字号为17，最小字号为5
        _matchNumberLabel.font = [UIFont systemFontOfSize:17];
    }
    return _matchNumberLabel;
}

@end
